package utils;

public class Pair<T extends Comparable<T>, U extends Comparable<U>> implements Comparable<Pair<T, U>> {
    
    public final T first;
    public final U second;



    Pair(T first, U second) {
        this.first = first;
        this.second = second;
    }

    public int compareTo(Pair<T, U> p) {
        int r = first.compareTo(p.first);
        return r == 0 ? second.compareTo(p.second) : r;
    }

        public static <A extends Comparable<A>,B extends Comparable<B>> Pair <A,B> valueOf(A a, B b){
        return new Pair<A, B>(a ,b);
    }

}

